package day0726API;

public class Test6 {
    public static void main(String[] args) {
        Runnable task1=()->{
            while(true){
                try {
                    Thread.sleep(900);
                    System.out.println(Thread.currentThread().getName()+"::卖包子");
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
        };

        Thread t1=new Thread(task1);
        t1.start();

        Runnable task2=()->{
            while(true){
                try {
                    Thread.sleep(900);
                    System.out.println(Thread.currentThread().getName()+"::卖水果");
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
        };

        Thread t2=new Thread(task2);
        t2.start();
        /*Runnable task1=new Runnable(){
            public void run() {
                while(true){
                    try {
                        Thread.sleep(900);
                        System.out.println(Thread.currentThread().getName()+"::卖包子");
                    }catch (InterruptedException e){
                        e.printStackTrace();
                    }
                }
            }
        };

        Thread t1=new Thread(task1);
        t1.start();

        Runnable task2=new Runnable(){
            public void run() {
                while(true){
                    try {
                        Thread.sleep(900);
                        System.out.println(Thread.currentThread().getName()+"::卖水果");
                    }catch (InterruptedException e){
                        e.printStackTrace();
                    }
                }
            }
        };

        Thread t2=new Thread(task2);
        t2.start();*/

    }
}
